package org.tgcloud.group.web.controller.app;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.*;
import org.tgcloud.group.core.APPResultMessage;
import org.tgcloud.group.service.app.LoginService;
import org.tgcloud.group.web.controller.dto.user.LoginUserDTO;
import org.tgcloud.group.web.controller.req.LoginAppReq;

import java.util.List;

/**
 * @author: zhy
 * @create: 2023-08-14 15:39
 * @description:
 */
@Api(tags = "登录管理相关接口")
@RestController
@RequestMapping("/app")
@EnableAutoConfiguration
public class LoginController extends ClientAPPBaseController{

    @Autowired
    private LoginService loginService;

    @ApiOperation(value = "微信登录")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/login")
    public APPResultMessage<LoginUserDTO, List> doLogin(@RequestBody LoginAppReq req) {
        return loginService.doAppLogin(req);
    }

    @ApiOperation(value = "开拓者微信假登录")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/loginTest")
    public APPResultMessage<LoginUserDTO, List> doLoginTest() {
        return loginService.appLoginTest();
    }

    @ApiOperation(value = "渠道微信假登录")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/loginTest2")
    public APPResultMessage<LoginUserDTO, List> doLoginTest2() {
        return loginService.appLoginTest2();
    }

    @ApiOperation(value = "渠道微信假登录3")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/loginTest3")
    public APPResultMessage<LoginUserDTO, List> doLoginTest3() {
        return loginService.appLoginTest3();
    }

    @ApiOperation(value = "渠道微信假登录4")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/loginTest4")
    public APPResultMessage<LoginUserDTO, List> doLoginTest4() {
        return loginService.appLoginTest4();
    }

    @ApiOperation(value = "渠道微信假登录5")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/loginTest5")
    public APPResultMessage<LoginUserDTO, List> doLoginTest5() {
        return loginService.appLoginTest5();
    }

    @ApiOperation(value = "微信假登录")
    @ApiImplicitParams({
    })
    @ResponseBody
    @PostMapping(value = "/loginTestNew")
    public APPResultMessage<LoginUserDTO, List> doLoginTestNew(@RequestBody LoginAppReq req) {
        return loginService.appLoginTestNew(req.getTestUserId());
    }
}
